/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package passwordchecker;

/**
 *
 * @author igor
 */
public class retornaForca {
    
    public static final String FORCA_MUITO_FRACO = "very weak";
    public static final String FORCA_FRACO = "weak";
    public static final String FORCA_MEDIO = "medium";
    public static final String FORCA_FORTE = "strong";
    public static final String FORCA_MUITO_FORTE = "stronger";
    public final String forca[] = {FORCA_MUITO_FRACO, FORCA_FRACO, FORCA_MEDIO, FORCA_FORTE, FORCA_MUITO_FORTE};
    public final int valores[] = {16, 25, 35, 45, Integer.MAX_VALUE};

    public void analisaForca(int is) {
        String res;

        for (int i = 0; i < valores.length; i++) {
            if (is < valores[i]) {
                res = forca[i];
                System.out.println("Strength verdict: " + res);
                break;
            }
        }

    }

    public int contSimb(String passwd, int contSimbs) {

        contSimbs = passwd.replaceAll("[^!@#$%^&*?_~]", "").length();

        return contSimbs;
    }

    public boolean temMinuscula(String passwd) {
        int minusculas;
        minusculas = passwd.replaceAll("[^a-z]", "").length();
        return minusculas > 0;

    }

    public boolean temMaiuscula(String passwd) {
        int maiusculas;
        maiusculas = passwd.replaceAll("[^A-Z]", "").length();
        return maiusculas > 0;

    }

    public boolean temNumero(String passwd) {
        int numeros;
        numeros = passwd.replaceAll("[^0-9]", "").length();
        return numeros > 0;
    }
    
    public int countNum(String passwd)
    {
        int numeros;
        numeros = passwd.replaceAll("[^0-9]", "").length();
        return numeros;
    }
    
}
